//
//  DDIDCardInputLabelView.m
//  GSDache
//
//  Created by guoshikeji_a on 2018/1/26.
//  Copyright © 2018年 tanyin. All rights reserved.
//

#import "DDCustomNumberInputLabelView.h"

@interface DDCustomNumberInputLabelView ()

@property (nonatomic, strong) UILabel *numberLabel;

@end

@implementation DDCustomNumberInputLabelView

- (instancetype)init
{
    self = [super init];
    if (self) {
        UILabel *label = [UILabel new];
        label.layer.cornerRadius = DDIDCardInputLabelViewPadding*2;
        label.layer.masksToBounds = true;
        label.textAlignment = NSTextAlignmentCenter;
        label.textColor = [UIColor blackColor];
        label.font = [UIFont systemFontOfSize:25];
        [self addSubview:label];
        self.numberLabel = label;
    }
    return self;
}


- (void)layoutSubviews {
    [super layoutSubviews];
    //
    self.numberLabel.frame = CGRectMake(DDIDCardInputLabelViewPadding, DDIDCardInputLabelViewPadding, self.frame.size.width-2*DDIDCardInputLabelViewPadding, self.frame.size.height-2*DDIDCardInputLabelViewPadding);
}

- (void)setTouchedSelf:(BOOL)touchedSelf {
    _touchedSelf = touchedSelf;
    if (touchedSelf) {
//        _numberLabel.backgroundColor = RGBHEXA(0xcdcdcd, 0.7);
//        _numberLabel.backgroundColor = [UIColor colorWithRed:((float)((0xCDCDCD & 0xFF0000) >> 16))/255.0 green:((float)((0xCDCDCD & 0xFF00) >> 8))/255.0 blue:((float)(0xCDCDCD & 0xFF))/255.0 alpha:0.7];
        _numberLabel.backgroundColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.7];
    }else {
        _numberLabel.backgroundColor = [UIColor whiteColor];
    }
}


- (void)setNumberText:(NSString *)numberText {
    _numberText = numberText;
    self.numberLabel.text = numberText;
}

@end
